package org.example;

import lombok.Data;
import org.junit.Test;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;

public class TTT {
    @Test
    public void test(){
        List<Attr> attrs=new ArrayList<>();
//        attrs.add(new Attr(null,"1"));
//        attrs.add(new Attr("2",null));
//        attrs.add(new Attr("3","3"));
//        attrs.add(new Attr("3","4"));
//        attrs.add(new Attr("3","5"));
//        attrs.add(new Attr("4","5"));
        Map<String, List<Attr>> collect = attrs.stream()
                .collect(Collectors.groupingBy(Attr::getCode));
        Set<Map.Entry<String, List<Attr>>> entries = collect.entrySet();
        System.out.println();
    }
    @Data
    static class Attr {
        private String code;
        private String val;

        public Attr(String code, String val) {
            this.code = code;
            this.val = val;
        }
    }
}
